package com.kaifamiao.inner;

public class Monkey {

    public void eat(String food){
        System.out.println( "猴吃" + food );
    }

    public static void main(String[] args) {
        Monkey m = new Monkey();
        m.eat( "香蕉" );
        System.out.println( m.getClass() );

        // 用匿名类继承具体类(还可以重写其父类中的方法哦)
        Monkey k = new Monkey(){
            @Override
            public void eat(String food) {
                System.out.println( "猴子孙悟空吃" + food );
            }
        };

        k.eat( "蟠桃" );
        System.out.println( k.getClass() );

    }

}
